import ReactDOM from "react-dom";
import React, { Component, createRef } from "react";

class App extends Component {

  // 初始化执行
  constructor() {
    super()
    // 做事情
    console.log('1. constructor')
    // this.state = {}   状态
    // this.ref = createRef()  ref
    // this.a = this.a.bind(this)   绑定this
  }

  // dom渲染完毕
  componentDidMount() {
    // 做事情
    console.log('3. componentDidMount')
    // 发请求
    // 操作dom
  }

  render() {
    // 做事情
    console.log('2. render')
    return (
      <div className="app">
        App组件
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById("root"));
